import re

s = 'life is short, i use python, i love python'

# 找到 life 和 python 中间的内容
r = re.search('life(.*)python(.*)python', s)
# 返回完整的匹配结果
print(r.group(0))

# 返回中间的内容
print(r.groups())
# print(r.group(0, 1, 2))
# print(r.group(1))
# print(r.group(2))

r = re.findall('life(.*)python(.*)python', s)
print(r)
